﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace QYmall.Core.Model.ViewModels
{
    /// <summary>
    /// 优惠券历史记录(显示)
    /// </summary>
    public class ShopCouponHistoryDto : ShopCouponHistoryEditDto
    {
        /// <summary>
        /// 自增ID
        /// </summary>
        [Display(Name = "自增ID")]
        public long Id { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        public DateTime AddTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 用户名
        /// </summary>
        [Display(Name = "用户名")]
        public string? UserName { get; set; }

        /// <summary>
        /// 优惠券信息
        /// </summary>
        public ShopCouponDto? ShopCoupon { get; set; }
    }

    /// <summary>
    /// 优惠券历史记录(编辑)
    /// </summary>
    public class ShopCouponHistoryEditDto
    {
        /// <summary>
        /// 所属优惠券ID
        /// </summary>
        [Display(Name = "所属优惠券")]
        public long CouponId { get; set; }

        /// <summary>
        /// 订单号
        /// </summary>
        [Display(Name = "订单号")]
        [StringLength(128)]
        public string? OrderNo { get; set; }

        /// <summary>
        /// 所属用户ID
        /// </summary>
        [Display(Name = "所属用户")]
        public int UserId { get; set; }

        /// <summary>
        /// 获取类型0后台赠1主动领
        /// </summary>
        [Display(Name = "获取类型")]
        public byte Type { get; set; } = 0;

        /// <summary>
        /// 使用状态0未用1已用
        /// </summary>
        [Display(Name = "使用状态")]
        public byte IsUse { get; set; } = 0;

        /// <summary>
        /// 状态0正常1禁用
        /// </summary>
        [Display(Name = "状态")]
        public byte Status { get; set; } = 0;

        /// <summary>
        /// 使用时间
        /// </summary>
        [Display(Name = "使用时间")]
        public DateTime? UseTime { get; set; }
    }

    /// <summary>
    /// 优惠券历史记录(购物车)
    /// </summary>
    public class ShopCouponHistoryCartDto
    {
        /// <summary>
        /// 自增ID
        /// </summary>
        [Display(Name = "自增ID")]
        public long Id { get; set; }

        /// <summary>
        /// 类型0店铺券1商品券
        /// </summary>
        [Display(Name = "优惠券类型")]
        public byte UseType { get; set; } = 0;

        /// <summary>
        /// 优惠券名称
        /// </summary>
        [Display(Name = "优惠券名称")]
        public string? Title { get; set; }

        /// <summary>
        /// 优惠券面额
        /// </summary>
        [Display(Name = "优惠券面额")]
        public decimal Amount { get; set; } = 0M;

        /// <summary>
        /// 门槛金额0不限制
        /// </summary>
        [Display(Name = "门槛金额")]
        public decimal MinAmount { get; set; } = 0M;

        /// <summary>
        /// 开始使用时间
        /// </summary>
        [Display(Name = "开始时间")]
        public DateTime? StartTime { get; set; }

        /// <summary>
        /// 结束使用时间
        /// </summary>
        [Display(Name = "结束时间")]
        public DateTime? EndTime { get; set; }
    }
}
